package com.cf.game;

import com.cf.game.service.pojo.H5Game;
import com.cf.game.service.service.h5game.H5GameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * game-server-Game
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/5/7 下午 04:32
 */
@Component
public class GameContext {

    private H5Game h5Game;

    private String gameCode="xxbw";

    @Autowired
    private H5GameService gameService;

    @PostConstruct
    public void init() throws IllegalAccessException {
        h5Game = gameService.getGameByGameCode(gameCode);
        if (h5Game == null) {
            throw new IllegalAccessException("为找到对应的游戏！");
        }
    }

    public String getGameCode() {
        return gameCode;
    }

    public void setGameCode(String gameCode) {
        this.gameCode = gameCode;
    }

    public H5GameService getGameService() {
        return gameService;
    }

    public void setGameService(H5GameService gameService) {
        this.gameService = gameService;
    }

    public H5Game getH5Game() {
        return h5Game;
    }


    public void setH5Game(H5Game h5Game) {
        this.h5Game = h5Game;
    }
}
